﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace DPW
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            
            routes.MapRoute(
                name: "CategoryNew",
                url: "c/New",
                defaults: new { controller = "Category",  action = "New" }
            );
            routes.MapRoute(
                name: "CategoryByTitle",
                url: "c/{id}",
                defaults: new { controller = "Category", action = "Details", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "PoemCreate",
                url: "p/Create",
                defaults: new { controller = "Poem", action = "Create" }
            );
            routes.MapRoute(
                name: "PoemByTitle",
                url: "p/{id}",
                defaults: new { controller = "Poem", action = "Details", id = UrlParameter.Optional }
            );

            routes.MapRoute(
            name: "HomeAbout",
            url: "About",
            defaults: new {controller = "Home", action = "About"}
            );

            routes.MapRoute(
                name: "Home",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute("Category1", "category", new { controller = "Category", action = "New", id = UrlParameter.Optional });
        }
    }
}